using Microsoft.Extensions.FileProviders;
using System.Text;

Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.

builder.Services.AddControllers();

var app = builder.Build();

// Configure the HTTP request pipeline.
var webDir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "web");
if (!Directory.Exists(webDir)) Directory.CreateDirectory(webDir!);

app.UseStaticFiles(new StaticFileOptions
{
  FileProvider = new PhysicalFileProvider(webDir)
});

app.UseHttpsRedirection();

app.UseAuthorization();

app.MapControllers();

app.Run();
